package www.rlicker.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import www.rlicker.dao.IUserSourceDatailDao;
import www.rlicker.model.UserSourceDatail;
import www.rlicker.mybatis.Criteria;
import www.rlicker.service.IUserSourceDatailService;
import www.rlicker.utils.MessageConstant;
import www.rlicker.utils.TranslateToMap;

@Service
public class UserSourceDatailServiceImpl implements IUserSourceDatailService{


	/**
	 * 
	 *��ҳ��ѯ��
	 * 
	 **/
	public List<Map<String, Object>>  queryPage (Criteria<UserSourceDatail> param){
		List<UserSourceDatail> list = userSourceDatailRepository.queryPage(param);
		List<Map<String,Object>> map = TranslateToMap.convertListBean2ListMap(list,UserSourceDatail.class);
	return map;  }

	/**
	 * 
	 *��ҳ������ѯ��
	 * 
	 **/
	public Integer queryPageCount (Criteria<UserSourceDatail> param){
		return (Integer) userSourceDatailRepository.queryPageCount(param);
	}

	/**
	 * 
	 * ��ѯ����������ID��ѯ��
	 * 
	 **/
	public UserSourceDatail  queryEntity (Long id ){
		return userSourceDatailRepository.queryEntity(id);
	}

	/**
	 * 
	 * ɾ������������IDɾ����
	 * 
	 **/
	public String deleteById (Long id ){
		int result = userSourceDatailRepository.deleteById(id);
			if ( result != 1) {
					return MessageConstant.USER_TYPE_3;
			}
			return null;
	}

	/**
	 * 
	 *��� ��ƥ����ֵ���ֶ�
	 * 
	 **/
	public String insert(UserSourceDatail record ){
		int result = userSourceDatailRepository.insert(record);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_4;
			}
			return null;
	}

	/**
	 * 
	 * �޸ģ�ƥ����ֵ���ֶΣ�
	 * 
	 **/
	public String update (Criteria<UserSourceDatail> param){
		int result = userSourceDatailRepository.update(param);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_5;
			}
			return null;
	}

	@Resource
	private IUserSourceDatailDao userSourceDatailRepository;

}